package com.admission.web.admin;

import java.io.IOException;

import org.apache.struts2.convention.annotation.Namespace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springside.modules.utils.web.struts2.Struts2Utils;
import org.xml.sax.SAXException;

import com.admission.util.StaticIndex;
import com.opensymphony.xwork2.ActionSupport;

@Namespace("/admin")
public class IndexAction extends ActionSupport {

	private static final long serialVersionUID = 6953649487548832936L;
	private StaticIndex staticIndex;

	@Override
	public String execute() throws Exception {
		return SUCCESS;
	}

	public String reflashMainPage() throws IllegalArgumentException,
			IOException, SAXException, IllegalAccessException {
		staticIndex.createHtmlForMainPage();
		Struts2Utils.renderText("SUCCESS");
		return null;
	}

	@Autowired
	public void setStaticIndex(StaticIndex staticIndex) {
		this.staticIndex = staticIndex;
	}
}
